#include"Task.hpp"
#include"ThreadPool.hpp"
#include<memory>
#include<time.h>

int main()
{
    srand(time(nullptr) ^ getpid());
    EnableConsoleLogStrategy();

    int cnt =10;
    while(cnt--)
    {
        //生产任务
        int x = rand()%10 +1;
        usleep(rand()%73);//休眠一会
        int y = rand()%5 + 1;
        Task t(x , y);

        //将任务push 到任务队列中
        ThreadPool<Task>::GetInstance()->Enqueue(t);
        sleep(1);
    }

    ThreadPool<Task>::GetInstance()->Stop();//线程池退出
    ThreadPool<Task>::GetInstance()->Wait();


    return 0;
}